<!--{include admin/top.html}-->
	<div class="mainPage">
	<!--{if $act == 'index'}-->
	<script>
		function chkAll(obj){
			$("#frm input[type='checkbox']").attr("checked",obj.checked);
		}
		function delAll(){
			if($("input:checked").length > 1){
				$("#frm").attr("action","{:parse_uri('admin_article-del')}");
				$("#frm").submit();
			}else{
				alert("请选择要删除的文章!");
				return false;
			}
		}
		function passAll(num){
			if($("input:checked").length > 0){
				if(parseInt(num) >1){
					$("#frm").attr("action","{:parse_uri('admin_article-pass')}");
				}else{
					$("#frm").attr("action","{:parse_uri('admin_article-recommend')}");
				}
				$("#frm").submit();
			}else{
				alert("请选择文章!");
				return false;
			}
		}
	</script>
		<h1 class="title">新闻动态
			<span class='sub_menu'>
				&nbsp;<a href="{:parse_uri('admin_article-add')}">添加动态</a>
			</span>
		</h1>
		<form id="frm" style="margin:0;padding:0;" method="post" action="" >
		<table width="100%" align=center cellspacing=0 cellpadding=0 border=0>
		<tr >
			<td width="8%" align=center>
				<p><b>选择</b></p></td>
			<td width="22%" align=center><p><b>标题</b></p></td>
			<td width="10%" align=center><p><b>类别</b></p></td>
			<td width="10%" align=center><p><b>审核</b></p></td>
			<td width="10%" align=center><p><b>作者</b></p></td>
			<td width="8%" align=center><p><b>浏览</b></p></td>
			<td width="15%" align=center><p><b>日期</b></p></td>
			<td width="15%" align=center><p><b>操作</b></p></td>
		</tr>
		<!--{foreach $arts $k $v}-->
		<tr class="ctr">
			<td align=center><input type="checkbox" name="id[]" value="{$v['Id']}" /></td>
			<td align=center><p>{if $v['status'] > 1}[<span style="color:green">荐</span>]{/if}&nbsp;{$v['title']|12}</p></td>
			<td align=center><p>{$v['cat_name']}</p></td>
			<td align=center><p>{if $v['status']>0}<span style="color:green">通过</span>{else}<span style="color:gray">未审核</span>{/if}</p></td>
			<td align=center><p>{$v['author']}</p></td>
			<td align=center><p>{$v['views']}</p></td>
			<td align=center><p>{:date("Y-m-d",$v['dateline'])}</p></td>
			<td align=center><p>
			<a href="{:parse_uri('admin_article-modify-id-%d',$v['Id'])}">修改</a> &nbsp;|&nbsp; 
			<a href="{:parse_uri('admin_article-del-id-%d',$v['Id'])}">删除</a></p></td>
		</tr>
		<!--{/foreach}-->
		<tr>
			<td   colspan=7 style="padding-top:4px;padding-bottom:0px;">
			<!--{include admin/page.html}-->
			<a href="javascript:void(0)" onclick="delAll()">删除所选</a>&nbsp;&nbsp;
			<a href="javascript:void(0)" onclick="passAll(0)">通过所选</a>&nbsp;&nbsp;
			<a href="javascript:void(0)" onclick="passAll(1)">推荐所选</a>
			</td>
		</tr>
		</table>
		</form>
	<!--{else if $act == 'add' || $act == 'modify'}-->
	<script>
		function showUpload(obj){
			if(obj.value=='true'){ 
				//true//
				if(obj.checked){
					$("#upload").hide();
					$("input[type=checkbox][value=false]").removeAttr('checked');
				}else{
					
				}
			}else{
				if(obj.checked){
					$("#upload").show();
					$("input[type=checkbox][value=true]").removeAttr('checked');
				}else{
					$("#upload").hide();
				}
			}
		}
		function getTags(){
			var str = Dialog('选择标签','{:parse_uri('admin_other-tags-do-check')}',0,0);
			if(str == undefined){
				return false;
			}else if(str.length==0){
				return false;
			}
			str = str.split(",");
			var tags = $("#tags").val();
			for(var j=0;j<str.length;j++){
				var loc = parseInt(tags.InStr(str[j]));
				if(loc > -1){
					var reg  = "/,?"+str[j]+"/ig";
					tags = tags.replace(eval(reg),"");
					if(tags.substring(0,1)==","){
						tags = tags.substring(1,tags.length);
					}
				}else{
					if(tags.length == 0){
						tags = str[j];
					}else{
						tags += ","+str[j];
					}
				}
			}
			$("#tags").val(tags);
		}
	</script>
		<h1 class="title">添加动态
			<span class='sub_menu'>
				&nbsp;<a href="{:parse_uri('admin_article-index')}">返回列表</a>
			</span>
		</h1>
		<form action="{:parse_uri('admin_article-save')}" id="frm" method="post" enctype="multipart/form-data">
		<p class="field-p"  style="line-height:30px;">
			动态标题: <input name="title" value="{$art['title']}" class="ipt" style="width:396px;" />
		</p>
		<p class="field-p" style="line-height:30px;">
			<span style="word-spacing:18px;">类 别</span>: 
			<select style="width:100px;" name="cat_id">
			<!--{foreach $cats $k $v}-->
				<option value="{$v['Id']}" {if $v['Id'] == $art['cat_id']}selected{/if}>{$v['cat_name']}</option>
				<!--{foreach $v['sub'] $subk $subv}-->
					<option value="{$subv['Id']}" {if $subv['Id'] == $art['cat_id']}selected{/if}>&nbsp;&nbsp;{if $subk === 0 && sizeof($v['sub'])!=1}┌{else if $subk == (sizeof($v['sub'])-1)}└{else}├{/if}&nbsp;{$subv['cat_name']}</option>
				<!--{/foreach}-->
			<!--{/foreach}-->
			</select>
			<span style="word-spacing:5px;">&nbsp;
			作 者</span>: <input name="author" value="{$art['author']?$art['author']:$_SESSION['admin']['uname']}" class="ipt" style="width:80px;" />
			<span style="word-spacing:5px;">&nbsp;
			来 源</span>:  <input name="source" value="{$art['source']?$art['source']:'boyangsofa'}" class="ipt" style="width:80px;" />
		</p>
		<p class="field-p"  style="line-height:30px;">
			<span style="word-spacing:0.6px;">关 键 字</span>: <input name="keywords" value="{$art['keywords']?$art['keywords']:'boyangsofa'}" maxlength="30" class="ipt" style="width:300px;" /> 
			<span class="errmsg">英文逗号分隔,30字以内</span>
		</p>
		<p class="field-p"  style="line-height:30px;">
			封面图片: 
			{if $art['pic']}
			<a href="{__HOST__}/{$art['pic']}" target="_blank">查看图片</a>
			重新提取 <input type="checkbox" name="getWay" value="true"  onclick="showUpload(this)" /> 
			重新上传 <input type="checkbox" name="getWay" value="false" onclick="showUpload(this)" />
			{else}
			自动提取 <input type="checkbox" name="getWay" value="true"  onclick="showUpload(this)" /> 
			本地上传 <input type="checkbox" name="getWay" value="false" onclick="showUpload(this)" />
			{/if}
			<input type="file" id="upload" name="userfile[]" style="display:none"/>

		</p>
		<p >
		<textarea name="content" style="display:none">{$art['content']}</textarea>
		</p>
		<p><iframe ID="Editor" name="Editor" src="{__HOST__}/public/Editor/index.html?ID=content" frameBorder="0" marginHeight="0" marginWidth="0" scrolling="No" style="height:320px;width:600px"></iframe></p>

		<p class="field-p"  style="line-height:30px;">
			<span style="word-spacing:18px;">标 签</span>: <input name="tags" id="tags" value="{$art['tags']?$art['tags']:''}" maxlength="30" class="ipt" style="width:300px;" /> 
			<a href="javascript:void(0)" onclick="getTags()"><span class="errmsg" style="word-spacing:2px;color:red">[&nbsp;标签列表&nbsp;]</span></a>
			<span class="errmsg">英文逗号分隔</span>
		</p>
		
		<p style='margin-top:10px;'><input type="submit" value='提交'class="submit"/>
		审核通过: <input type="checkbox" name="status" value="1" {if $art['status'] == '1'}checked="checked"{/if}/>
		</p>
		<input type="hidden" name="id" value="{$art['Id']}"  />
		</form>
	<!--{/if}-->
		<div align="center" class="runtime"> {__TIMENOW__} Processed in {__RUNTIME__} second(s) {__QUERY__} queries &nbsp;</div>
	</div>
</body>
</html>